#ifndef RANGE_OBJECT_H
#define RANGE_OBJECT_H

#include "NumberObject.h"

#include <object_v2/object_v2.h>

typedef enum _RangeObjectEvent RangeObjectEvent;
enum _RangeObjectEvent
{
        RANGE_OBJECT_EVENT_NUMBER,
        RANGE_OBJECT_EVENT_ENDL,
        RANGE_OBJECT_EVENT_DASH, // 破折号
        RANGE_OBJECT_EVENT_OTHER
};

typedef enum _RangeObjectState RangeObjectState;
enum _RangeObjectState
{
        RANGE_OBJECT_STATE_START,
        RANGE_OBJECT_STATE_RECV,
        RANGE_OBJECT_STATE_REFRESH,
        RANGE_OBJECT_STATE_FAILED,
        RANGE_OBJECT_STATE_ENDL
};

OBJECT_DECLARE (RangeObject, range_object)
#define RANGE_OBJECT(any) ((RangeObject*)(any))
struct _RangeObject
{
        NumberObject     parent_instance; // 父类作为范围下限
        int              upper_range;     // 范围上限
        RangeObjectState range_state;
};

bool range_object_is_number_in_range (RangeObject* obj, int number);

int  range_object_analysis_range (RangeObject*             obj,
                                  ObjectStringApplication* range);

#endif